package com.bangcommunity.bbframe.sdm.aop.handler;

import org.aspectj.lang.ProceedingJoinPoint;

import java.lang.reflect.Method;

/**
 * Created by tanghc on 17/1/18.
 */
public abstract class FinalHandler extends AbstractorAopHandler {
    protected long endTime = System.currentTimeMillis();
    protected long elapse = 0;
    protected Object result;

    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }

    public void setElapse(long elapse) {
        this.elapse = elapse;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    @Override
    protected boolean doHandler(ProceedingJoinPoint pjp, Object[] args, Method method, String className) {
        try {
            return doFinalHandler(pjp, args, method, className);
        } catch (Exception e) {
            logger.error("aop FinalHandler exception ", e);
        }
        return true;
    }

    protected abstract boolean doFinalHandler(ProceedingJoinPoint pjp, Object[] args, Method method, String className);
}
